home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.20021006-20030409 / 000305_fdc@columbia.edu_Thu Feb 13 18:10:14 EST 2003.msg < prev    next >
Text File  |  2020-01-01  |  2KB  |  52 lines

  1. Article: 14101 of comp.protocols.kermit.misc
  2. Path: newsmaster.cc.columbia.edu!news.columbia.edu!news-not-for-mail
  3. From: fdc@columbia.edu (Frank da Cruz)
  4. Newsgroups: comp.protocols.kermit.misc
  5. Subject: Re: Dealing with '\' char in strings of file locations
  6. Date: 13 Feb 2003 18:09:33 -0500
  7. Organization: Columbia University
  8. Lines: 35
  9. Message-ID: <b2h8jd$dp7$1@watsol.cc.columbia.edu>
  10. References: <a70f50e.0302121525.7922c8c3@posting.google.com> <a70f50e.0302131451.4fe831f@posting.google.com>
  11. NNTP-Posting-Host: watsol.cc.columbia.edu
  12. X-Trace: newsmaster.cc.columbia.edu 1045177775 5205 128.59.39.139 (13 Feb 2003 23:09:35 GMT)
  13. X-Complaints-To: postmaster@columbia.edu
  14. NNTP-Posting-Date: 13 Feb 2003 23:09:35 GMT
  15. Xref: newsmaster.cc.columbia.edu comp.protocols.kermit.misc:14101
  16.  
  17. In article <a70f50e.0302131451.4fe831f@posting.google.com>,
  18. Wes <wesdog@hotmail.com> wrote:
  19. : I have learned alot since my last post...  I believe I understand the
  20. : difference between ASSIGN, EVALUATE and DEFINE.
  21. : However I am still having trouble getting my mind around parsing UNC
  22. : paths.  I have a UNC path "\\myserver\dir\subdir\file.txt" in the same
  23. : location of each line (char 50 through 300 is reserved for the UNC,
  24. : whitespace fills in what isnt used).
  25. Let's assume the UNC is stored in a macro (variable) called line, and
  26. that it's left-adjusted in columns 50-300, right-padded by spaces.
  27.  
  28.   assign unc \ftrim(\fsubstr(\m(line),50,250))
  29.  
  30. This extracts the UNC and trims trailing blanks.  Now we can change those
  31. pesky backslashes into harmless "forward" slashes:
  32.  
  33.   assign unc \freplace(\m(unc),\\,/)
  34.  
  35. Now the \m(unc) value is:
  36.  
  37.   //myserver/dir/subdir/file.txt
  38.  
  39. Of course all this could be combined into one statement:
  40.  
  41.   assign unc \ftrim(\fsubstr(\freplace(\m(line),\\,/),50,250))
  42.  
  43. Now to whack off the unwanted parts, you can use:
  44.  
  45.   void \fsplit(\m(unc),&a,/)
  46.   asg \%n \fdim(&a)
  47.   asg path \&a[\%n-1]/\&a[\%n]
  48.  
  49. - Frank
  50.